package data.promotion;
import java.util.ArrayList;
import data.Data;
import data.ItemData;
import data.ItemRecord;


public class ItemDiscountData extends Data {

	private ArrayList<ItemDiscountRecord> itemDiscountList=new ArrayList<ItemDiscountRecord>();
	
	
	public ItemDiscountData(){
		
	}
	
	public void setItem(ItemRecord item){
		ItemDiscountRecord itemDiscount=this.getItemDiscountByID(item.getID());
		if(itemDiscount!=null){
			itemDiscount.setItem(item);
		}
	}
	
	public void setItemList(ItemData itemList){
		for(int i=0;i<itemDiscountList.size();i++){
			ItemDiscountRecord itemDiscount=(ItemDiscountRecord) itemDiscountList.get(i);
			itemDiscount.setItemList(itemList);
		}
	}
	
	
	public ItemDiscountRecord getItemDiscountByID(String item_id){
		for(int i=0;i<itemDiscountList.size();i++){
			ItemDiscountRecord itemDiscount=(ItemDiscountRecord) itemDiscountList.get(i);
			if(itemDiscount.getItemID().equals(item_id)){
				return itemDiscount;
			}
		}
		return null;
	}
}
